#pragma once

#include "../import/cimport.h"
#include "../camera/camera.h"

namespace NEngine {

#define MAX_LIGHTS 4

// ================================================================================================    
// Abstract that class for building
// ================================================================================================    
class CBuildLights {

public: 

    struct SConeLight {
        Vector4 sptlightdir;
        Vector4 sptlightpos;
        Vector4 sptclrs;
        Vector4 penumbras;
    };

    struct SLights {
        Vector4 dirlights[MAX_LIGHTS];
        Vector4 dirclrs[MAX_LIGHTS];
        Vector4 ptlights[MAX_LIGHTS];
        Vector4 ptclrs[MAX_LIGHTS];
        SConeLight cones[MAX_LIGHTS];
    };

protected:

    bool built;                        // -- flag to indicate if resources were built
    SLights lightbuf;                 // -- the light buffer

public:

    // -- constructor
    CBuildLights();

    // -- build the lights in the scene
    void BuildLights(CImportLights::SLightObj& lobjects, CDynamicArray<CCamera>& cams,
                     CDynamicArray<CCamera*>& lviews);

    // -- accessors
    SLights GetConstLightBuffer();
};

// ================================================================================================
// Constructor
// ================================================================================================
inline CBuildLights::CBuildLights() {
}

// ================================================================================================
// Accessors
// ================================================================================================
inline CBuildLights::SLights CBuildLights::GetConstLightBuffer() {
    return lightbuf;
}

} // namespace NEngine